#![allow(warnings)]

extern crate actix_web;
extern crate chrono;
#[macro_use]
extern crate diesel;
extern crate dotenv;
extern crate env_logger;
extern crate futures;
extern crate jsonwebtoken as jwt;
extern crate md5;
extern crate num_cpus;
extern crate redis;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;

use actix_web::{actix::System, server};
use config::router;

mod config;
mod model;
mod network;
mod controller;
mod common;
mod handler;

fn main() {
    ::std::env::set_var("RUST_LOG", "wapp=info");
    ::std::env::set_var("RUST_BACKTRACE", "1");
    env_logger::init();
    let sys = System::new("wapp");
    server::new(move ||
        vec![
            router::api_state().boxed(),
            router::app().boxed(),
        ])
        .bind("localhost:8081").unwrap()
        .shutdown_timeout(2)
        .start();
    sys.run();
}
